package com.model;

import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.model.xmlElement.output.DataBase;
import com.tool.PropertiesUtil;

public class LogDateBaseSingletion {
	public static final Logger LOG = LoggerFactory.getLogger(LogDateBaseSingletion.class);
	
	private static DataBase logDateBase;
	private LogDateBaseSingletion(){}
	
	public static DataBase getSingle(){
		if(logDateBase == null){
			synchronized (DataBase.class){
				if(logDateBase == null){
					Properties prop = PropertiesUtil.readPropertiesAsStream("logDateBase.properties");
					logDateBase = new DataBase(prop.getProperty("database_name"), prop.getProperty("database_url"), 
							prop.getProperty("database_username"), prop.getProperty("database_password"));
				}
			}
		}
		return logDateBase;
	}

}
